<%@ page import="com.apexedu.identity.security.CasLoginUtil" %>
<%@ page import="com.apexedu.identity.entity.TSysUser" %>
<%@ page import="com.apexedu.identity.IdConstants" %>
<%@ page import="com.apexedu.portal.constant.Constants" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    request.setAttribute("basePath", request.getContextPath());
    TSysUser user = (TSysUser) request.getSession().getAttribute(IdConstants.SESSION_USER);
    String type = (String) request.getSession().getAttribute("type");
    if (null != user) {
        request.setAttribute("userid", user.getUserloginid());
        request.setAttribute("username", user.getUsername());
    }
%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link href="${basePath}/resources/css/mh.qh.css" rel="stylesheet">
<script type="text/javascript" src="${basePath}/clientui/js/jquery-1.4.js"></script>
<script type="text/javascript" src="${basePath}/resources/js/mh.qh.index.js"></script>
<script>
    function execLogout() {
        if (window.confirm('确定要退出系统吗？')) {
            $.get("${basePath}/identity/ajaxlogin.action?act=logout", {q: (new Date()).getTime()}, function (data) {
                data = eval("(" + data + ")");
                if (data.msg == 'success') {
                    <%
                if( CasLoginUtil.isSsoEnabled() ){
                %>
                    window.location.href = '<%=CasLoginUtil.getCasServerLogoutUrl()%>';
                    <%
                    }else{
                    %>
                    window.location.href = '<%=request.getContextPath() %>?t=' + Math.round(new Date / 1000);
                    <%
                    }
                    %>
                } else {
                    alert(data.msg);
                }
            });
            setTimeout(function () {
                <%
                if( CasLoginUtil.isSsoEnabled() ){
                %>
                window.location.href = '<%=CasLoginUtil.getCasServerLogoutUrl()%>';
                <%
                }else{
                %>
                window.location.href = '<%=request.getContextPath() %>?t=' + Math.round(new Date / 1000);
                <%
                }
                %>
            }, 1000);
        }
    }
</script>
<div id="head">
    <div id="headline">
        <%if (null != user) {%>
        <span class="infoSpan" m="infoMenu">
            <div class="infoDiv"><img alt="用户头像" src="/userinfo/${userid}"
                                      style="width: 36px; height: 36px;margin-left: 10px;"
                                      onerror="this.src='${basePath}/userinfo/user_male_portrait.png'">
                <span style="text-align: left;vertical-align: top;margin: 0 0 0 5px;width: 100px;white-space: nowrap;text-overflow: ellipsis;overflow: hidden;"
                      title="${username}">
                    |&nbsp;&nbsp;${username}
                </span>
            </div>
            <ul class="infoMenu">
                <%if ("admin".equals(user.getUserloginid())) {%>
                <li onclick="window.open('/identity/index.action?flag=true')"><img
                        src="${basePath}/resources/images/8.png">管理后台
                </li>
                <%if (!Constants.MhUserType.LS.equals(type)) {%>
                <li onclick="location.href='${basePath}/s/uc/qh/i?type=ls'"><img
                        src="${basePath}/resources/images/59.png">教师站点
                </li>
                <%
                    }
                    if (!Constants.MhUserType.XS.equals(type)) {
                %>
                <li onclick="location.href='${basePath}/s/uc/qh/i?type=xs'"><img
                        src="${basePath}/resources/images/59.png">学生站点
                        <%  }
                    }%>
                <li onclick="window.open('${basePath}/s/uc/mh/hp')"><img
                        src="${basePath}/resources/images/11.png">头像上传
                </li>
                <li onclick="window.open('${basePath}/s/uc/mh/up')"><img
                        src="${basePath}/resources/images/47.png">修改密码
                </li>
                <%--<li onclick="window.open('/nj6.1.2-portlet/html/userinfo/password.jsp')"><img
                        src="${basePath}/resources/images/59.png">信息维护
                </li>--%>
            </ul>
        </span>
        <span class="exitSpan" onclick="execLogout()">注销</span>
        <%}%>
    </div>
    <div id="title">
        <ul class="titleUl title${type}">
            <%if (null != user) {%>
            <li onclick="location.href='${basePath}/s/uc/qh/i'" class="titleLi">首页</li>
            <li onclick="location.href='${basePath}/s/uc/qh/n'" class="titleLi">警院新闻</li>
            <%if (Constants.MhUserType.LS.equals(type)) {%>
            <li m="titleMenu1" class="titleLi">办公事务
                <div class="titleMenu titleMenu1">
                    <ul class="titleMenuLeft">
                        <li>办公事务</li>
                    </ul>
                    <ul class="titleMenuRight">

                    </ul>
                    <%if ("admin".equals(user.getUserloginid())) {%>
                    <div class="dyDiv" onclick="window.open('${basePath}/s/uc/se/i/bgsw')"><img
                            src="${basePath}/resources/images/icons/icons-86.png">订阅
                    </div>
                    <%}%>
                </div>
            </li>
            <li onclick="location.href='${basePath}/s/uc/qh/r'" class="titleLi">规章制度</li>
            <li onclick="location.href='${basePath}/s/uc/qh/d'" class="titleLi">部门动态</li>
            <%}%>
            <li onclick="location.href='${basePath}/s/uc/qh/no'" class="titleLi">院内通报</li>
            <li m="titleMenu2" class="titleLi">信息服务
                <div class="titleMenu titleMenu2">
                    <ul class="titleMenuLeft">
                        <li>信息服务</li>
                    </ul>
                    <ul class="titleMenuRight">

                    </ul>
                    <%if ("admin".equals(user.getUserloginid())) {%>
                    <%if (Constants.MhUserType.LS.equals(type)) {%>
                    <div class="dyDiv" onclick="window.open('${basePath}/s/uc/se/i/xxfw')"><img
                            src="${basePath}/resources/images/icons/icons-86.png">订阅
                    </div>
                    <%} else if (Constants.MhUserType.XS.equals(type)) {%>
                    <div class="dyDiv" onclick="window.open('${basePath}/s/uc/se/i/xxfwxs')"><img
                            src="${basePath}/resources/images/icons/icons-86.png">订阅
                    </div>
                    <%
                            }
                        }
                    %>
                </div>
            </li>
            <%}%>
        </ul>
    </div>
    <div id="titleBottom"></div>
    <div id="logo"></div>
</div>
